#if !defined(_APP_SERIAL_)
#define _APP_SERIAL_

#include <termios.h>
#include "app_device.h"
#include "app_message.h"

typedef enum{
    BR_6600=B9600,
    BR_115200=B115200
}BraudRate;

typedef enum{
    Parity_None = 0,
    Parity_Odd = PARENB | PARODD,
    Parity_Even = PARENB
}Parity;

typedef enum{
    StopBits_1 = 0,
    StopBits_2=CSTOPB
}StopBits;

typedef struct {
    Device super;
    BraudRate braud_rate;
    Parity parity;
    StopBits stop_bits;
} SerialDevice;

SerialDevice *app_serial_init(char *filename);
int app_serial_setBaudrate(SerialDevice *serial, BraudRate baud_rate);
int app_serial_setParity(SerialDevice *serial, BraudRate baud_rate);
int app_serial_setStopBits(SerialDevice *serial, BraudRate baud_rate);




#endif // _APP_SERIAL_
